package twel.probenprophet.domain.rules.magic.decorators;

import twel.probenprophet.base.enums.Representation;
import twel.probenprophet.domain.rules.magic.CastableSpell;

public abstract class SpontaneousModificationDecorator implements CastableSpell {

	private final CastableSpell decorated;
	private final int times;

	public SpontaneousModificationDecorator(CastableSpell decorated, int times) {
		this.decorated = decorated;
		this.times = times;
	}

	public SpontaneousModificationDecorator(CastableSpell decorated) {
		this(decorated, 1);
	}

	public CastableSpell getDecorated() {
		return decorated;
	}

	public int getTimes() {
		return times;
	}

	@Override
	public int getSpontaneousModificationPoints() {
		return getSpellSkillModifier() * getTimes() + decorated.getSpontaneousModificationPoints();
	}

	@Override
	public int getAstralEnergyCost() {
		return decorated.getAstralEnergyCost();
	}

	@Override
	public int getDifficulty() {
		return decorated.getDifficulty();
	}

	@Override
	public Representation getRepresentation() {
		return decorated.getRepresentation();
	}

	@Override
	public int getNumberOfModifications() {
		return getTimes() + decorated.getNumberOfModifications();
	}

	protected abstract Integer getSpellSkillModifier();

}
